package com.bsb.base.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.baomidou.mybatisplus.annotations.TableField;



public class SysResource implements Serializable {
	/**
	 * 菜单ID
	 */
    private Long id;

    private String name;

    private ResourceType type = ResourceType.menu; //资源类型

    private String url;
    /**
	 * 父菜单ID，一级菜单为0
	 */
    private Long parent_id;
    /**
	 * 父菜单名称
	 */
	@TableField(exist=false)
	private String parentName;

    private String parent_ids;

    private String permission;

    private Boolean available = Boolean.FALSE;
    
    private String icon;
    
    private List<SysResource> childList = new ArrayList<SysResource>();

    
    public static enum ResourceType {
    	catalog("目录"),menu("菜单"), button("按钮");

        private final String info;
        private ResourceType(String info) {
            this.info = info;
        }

        public String getInfo() {
            return info;
        }
    }
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public ResourceType getType() {
        return type;
    }

    public void setType(ResourceType type) {
        this.type = type;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Long getParent_id() {
        return parent_id;
    }

    public void setParent_id(Long parent_id) {
        this.parent_id = parent_id;
    }

    public String getParent_ids() {
        return parent_ids;
    }

    public void setParent_ids(String parent_ids) {
        this.parent_ids = parent_ids;
    }

    public String getPermission() {
        return permission;
    }

    public void setPermission(String permission) {
        this.permission = permission;
    }

    public Boolean getAvailable() {
        return available;
    }

    public void setAvailable(Boolean available) {
        this.available = available;
    }

	public boolean isRootNode() {
		return parent_id == 0;
	}

	public List<SysResource> getChildList() {
		return childList;
	}

	public void setChildList(List<SysResource> childList) {
		this.childList = childList;
	}

	public String makeSelfAsParentIds() {
		return getParent_ids() + getId() + "/";
	}

	public String getParentName() {
		return parentName;
	}

	public void setParentName(String parentName) {
		this.parentName = parentName;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}
	
	
}